
package com.yunfei.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwaggerConfiguration {

    @Bean(value = "productKuApi")
    public Docket productKuApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(productKuInfo())
                .groupName("1.产品库接口文档")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.yunfei.apiProductKu"))
                .paths(PathSelectors.any())
                .build();
    }
    @Bean(value = "defaultApi")
    public Docket defaultApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(groupApiV2Info())
                .groupName("2.财富管理平台App端产品中心接口文档")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.yunfei.api"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo productKuInfo(){
        return new ApiInfoBuilder()
                .title("产品库接口文档")
                .description("产品库接口文档")
                .termsOfServiceUrl("http://10.0.100.200/")
                .contact("zhengyunfei@ylcaifu.com")
                .version("3.0")
                .build();
    }
    private ApiInfo groupApiV2Info(){
        return new ApiInfoBuilder()
                .title("财富管理平台App端产品中心接口文档")
                .description("财富管理平台App端产品中心接口文档")
                .termsOfServiceUrl("http://10.0.100.200/")
                .contact("zhengyunfei@ylcaifu.com")
                .version("2.0")
                .build();
    }

}
